package lab.gene.action;

import java.util.Date;
import lab.gene.pojo.GeneAmpliconPurification;
import lab.gene.service.impl.GeneAmpliconPurificationServiceImpl;

import com.opensymphony.xwork2.ActionSupport;

public class ViewGeneAmpliconPurificationAction extends ActionSupport  {
	
	private static final long serialVersionUID = 1L;
	private Date recordDate = null;
	private Float ml;
	private String comments = null;
	private String geneName = null;
	private String stepType = null;
	private String ampType = null;
	
	public String execute() {
		System.out.println("View Gene AMP Action!");
		System.out.println(ampType);
		System.out.println(stepType);
		String result = "successC1";
		GeneAmpliconPurificationServiceImpl service = new GeneAmpliconPurificationServiceImpl();
		GeneAmpliconPurification amp= service.getGeneAmpliconPurification(geneName, stepType, ampType);
		if(amp != null) {
			recordDate = amp.getRecordDate();
			ml = amp.getMl();
			comments = amp.getComments();
		}
		switch(stepType) {
		case "C":
			if(ampType.equals("001026")) { 
				result = "successC1";
			}
			else{ 
				result = "successC2"; 
			}break;
		case "D":
			if(ampType.equals("001028")){
				result = "successD1";
			}
			else{ 
				result = "successD2";
			} break;
		}
		return result;
	}

	public Date getRecordDate() {
		return recordDate;
	}

	public void setRecordDate(Date recordDate) {
		this.recordDate = recordDate;
	}

	public Float getMl() {
		return ml;
	}

	public void setMl(Float ml) {
		this.ml = ml;
	}

	public String getComments() {
		return comments;
	}

	public void setComments(String comments) {
		this.comments = comments;
	}

	public String getGeneName() {
		return geneName;
	}

	public void setGeneName(String geneName) {
		this.geneName = geneName;
	}

	public String getStepType() {
		return stepType;
	}

	public void setStepType(String stepType) {
		this.stepType = stepType;
	}

	public String getAmpType() {
		return ampType;
	}

	public void setAmpType(String ampType) {
		this.ampType = ampType;
	}
}
